﻿<!DOCTYPE>

<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>渗碳炉批记录</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <style type="text/css">
        .linkbutton{margin-left:20px;width:85px;}
        .input{width: 120px; height: 22px}
        ul li{list-style:none;width:400px;line-height:30px;float:left;border:1px solid;text-align: center;}
        .labelT{width:150px;display: inline-block;}
        .deleteClass{background: #fed;}
    </style>
</head>
<body>
      <div class="panelSection">    
        <div class="easyui-panel " title="数据区域" style="padding:3px;max-height:600px" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
        <div style="margin-left: 75px;padding: 10px;"><label>日期：</label><span class="labelT STDATE"></span><label>试样编号：</label><span class="labelT SAMPLENO"></span><label>操作者：</label><span class="labelT CREATEEMPLOYEE"></span></div>
        <div style="display: flex;width:850px">
            <ul>
               
            </ul>
        </div>
         <div style="margin-left: 75px;padding: 10px;">
           </div>
        </div>
    </div>
      <div class="panelSection">    
        <div class="easyui-panel " title="按钮区域" style="padding:3px;" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false"> 
                 <input class="easyui-textbox" type="text"  id="DrawingNo" data-options="prompt:'请输入图号名称'" style="width: 180px; height: 22px" />
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.AddDrawingNo()" style="margin: 10px 0 10px 20px;">添加</a>
                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="page.DeleteDrawingNo()" style="margin: 10px 0 10px 20px;">删除</a>
        </div>
      </div>
      <div id="statusMessage" style="font-size: 14px; height: 40px"></div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script>
/*
创建人：longb
日期：2022-09-26
描述：热处理记录js
*/
var page = {
    workflowstepid: getParam("id"),
    ContainerID: getParam("ContainerID"),
    rootPath: getRootPath(), //网站根路径
    ajaxUrl: getRootPath() + "/Ashx/GongZhuangContainer/GZHeatRecordInfoHandler.ashx",
    //初始化页面
    init: function () {
        //page.bind();
        page.GZSTContainerRecord();
    },

    //添加图号
    AddDrawingNo: function () {
        var DrawingNo = $('#DrawingNo').textbox('getValue');
        if (DrawingNo == "") { displayMessage("请输入图号名称,再进行操作"); return; }
        //$('ul').append("<li>"+DrawingNo+"</li>");
        var param = {
            action: "AddDrawingNo",
            ContainerID: page.ContainerID,
            workflowstepid:page.workflowstepid,
            DrawingNo:DrawingNo
        };
        page.post(param, function (res) {
            if (res.Result) {
              page.GZSTContainerRecord();
            }
            displayMessage(res.Message,res.Result);
        });
    },
    //删除图号
    DeleteDrawingNo: function () {
        var ids = [];
        $("ul").find("li").each(function () {
            if($(this).hasClass("deleteClass")){
                //console.info($(this).attr("id"));
                ids.push($(this).attr("id"));
           }
        })
        if (ids.length == 0) { displayMessage("请选择图号记录,再进行操作"); return; }
         var param = {
            action: "DeleteDrawingNo",
            ids: ids.join(','),
        };
        page.post(param, function (res) {
            if (res.Result) {
             page.GZSTContainerRecord();
            }
            displayMessage(res.Message,res.Result);
            });
    },
   
    //查询热处理记录
    GZSTContainerRecord: function () {
        var param = {
            action: "GZSTContainerRecord",
            ContainerID: page.ContainerID,
            workflowstepid:page.workflowstepid
        };
        page.post(param, function (res) {
            if (res.Result) {
                if(res.DBDataSet.base.length==0){
                    $('.STDATE').text(res.ReturnData.STDATE);
                    $('.SAMPLENO').text(res.ReturnData.SAMPLENO);
                    $('.CREATEEMPLOYEE').text(res.ReturnData.CREATEEMPLOYEE);
                }else{
                    $('.STDATE').text(res.DBDataSet.base[0].STDATE);
                    $('.SAMPLENO').text(res.DBDataSet.base[0].SAMPLENO);
                    $('.CREATEEMPLOYEE').text(res.DBDataSet.base[0].CREATEEMPLOYEE);
                }
                var dghtml="<li>图号</li><li>图号</li>";
                $.each(res.DBDataSet.dg,function(index,item){
                    dghtml+="<li onclick='page.DrawingNoClass(this)' id="+item.GZSTCONTAINERRECORDDETAILID+">"+item.DRAWINGNO+"</li>";
                });
                $('ul').empty().html(dghtml);
            }
        });
    },
    DrawingNoClass:function(val){
        //console.info($(val).attr("id"));
        if($(val).hasClass("deleteClass")){
            $(val).removeClass("deleteClass");
        }else{
            $(val).addClass("deleteClass");
        }
    },
    //清除方法，重要！！！
    reset: function (iscondition, isresult) {
        clearMessage();
    },
    //post数据
    post: function (param, callback) {
        $.ajax({
            type: "Post",
            url: page.ajaxUrl,
            data: param,
            cashe: false,
            async: true,
            dataType: "json",
            beforeSend: function () {
                $.messager.progress({ text: '', msg: '处理中...' });
            },
            success: function (data) {
                $.messager.progress('close');
                callback(data);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.messager.progress('close');
                displayMessage(XMLHttpRequest.responseText, false);
            }
        });
    }
}
$(function () {
    page.init();
});
</script>
